package 线程.day4.demo3;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Client {
    public static void main(String[] args)throws Exception {
        Socket s=new Socket("192.168.71.32",999);
        System.out.println("开始向服务器发送信息。。。。");
        OutputStream os=s.getOutputStream();
        os.write("To be the best one?".getBytes());

        System.out.println("等待接收服务器消息、、、");
        Thread.sleep(1000);
        InputStream is=s.getInputStream();
        byte[]arr=new byte[1024];
        int len=is.read(arr);
        System.out.println("来自服务器的消息为："+new String(arr,0,len));
    }
}
